package fr.hoteia.appengine.archetype.server.web.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import fr.hoteia.appengine.archetype.client.Constants;

/**
 * <p>
 * <a href="DateUtil.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author Denis GOSSET <a href="http://www.hoteia.com"><i>Hoteia.com</i></a>
 * 
 */
public class DateUtil {

	/**
	 * 
	 */
	public static String formatDate(Date date, String typeFormat, String languageCode) {
		String newDate = Constants.EMPTY;
		String pattern = "yyyy/MM/dd";
		if(StringUtils.isEmpty(typeFormat)){
			typeFormat = Constants.LANGUAGE_FORMAT_TYPE_SHORT;
		}
		
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
		newDate = simpleDateFormat.format(date);

		return newDate;
	}

}
